from django.db import models

class Video(models.Model):
    """
    视频
    """
    id = models.AutoField(primary_key=True, verbose_name='ID')
    video_uuid = models.CharField(default='', max_length=50, verbose_name='Video UUID')
    user_id = models.IntegerField(verbose_name='User ID')
    timestamp = models.DateTimeField(auto_now_add=True, verbose_name='Timestamp')
    love_count = models.IntegerField(default=0, verbose_name='Love Count')

    video_title = models.CharField(max_length=255, verbose_name='Video Title')
    video_desc = models.TextField(default='', verbose_name='Video Description')
    view_count = models.IntegerField(default=0, verbose_name='View Count')


class VideoInteraction(models.Model):
    """
    视频互动
    """
    id = models.AutoField(primary_key=True, verbose_name='ID')
    video_id = models.IntegerField(verbose_name='Video ID')
    user_id = models.IntegerField(verbose_name='User ID')
    timestamp = models.DateTimeField(auto_now_add=True, verbose_name='Timestamp')

    class ActionChoices(models.TextChoices):
        LOVE = 'love', 'Love'
        DISLOVE = 'dislove', 'Dislove'
        NONE = 'none', 'None'

    action = models.CharField(
        max_length=10,
        choices=ActionChoices.choices,
        default=ActionChoices.NONE,
        verbose_name='Action'
    )


class VideoComment(models.Model):
    """
    视频评论
    """
    id = models.AutoField(primary_key=True, verbose_name='ID')
    video_id = models.IntegerField(verbose_name='Video ID')
    user_id = models.IntegerField(verbose_name='User ID')
    comment_content = models.TextField(verbose_name='Comment Content')
    timestamp = models.DateTimeField(auto_now_add=True, verbose_name='Comment Time')


class PrivateMessage(models.Model):
    """
    私聊消息
    """
    id = models.AutoField(primary_key=True, verbose_name='ID')
    sender_id = models.IntegerField(verbose_name='Sender ID')
    receiver_id = models.IntegerField(verbose_name='Receiver ID')
    message_content = models.TextField(verbose_name='Message Content')
    timestamp = models.DateTimeField(auto_now_add=True, verbose_name='Send Time')


class SystemNotification(models.Model):
    """
    系统通知
    """
    id = models.AutoField(primary_key=True, verbose_name='ID')
    notification_title = models.CharField(max_length=100, verbose_name='Notification Title')
    notification_content = models.TextField(verbose_name='Notification Content')
    timestamp = models.DateTimeField(auto_now_add=True, verbose_name='Notification Time')

class LoveRecord(models.Model):
    """
    视频点赞记录
    """
    id = models.AutoField(primary_key=True, verbose_name='ID')
    video_id = models.IntegerField(verbose_name='Video ID')
    user_id = models.IntegerField(verbose_name='User ID')
    timestamp = models.DateTimeField(auto_now_add=True, verbose_name='Love Time')
